<?php
	
	/**转账 到 解冻
	 * 
	 * @param unknown_type $pMerBillNo
	 * @return string
	 */

	function TransferUnfreeze($user_id,$platformNo,$pTrdAmt,$post_url,$sys='pc'){

		$user = array();
		$user = get_user_info("*","id = ".$user_id);
		//直接解冻
		$Sign_data = array();
		$Sign_data['ver'] = "0.44";
		$Sign_data['mchnt_cd'] = $platformNo;// 商户编号
		$Sign_data['mchnt_txn_ssn'] = $user['id'].time();//请求流水号
		$Sign_data['cust_no'] =  $user['mobile'];// 商户编号
		$Sign_data['amt'] = $pTrdAmt;// 商户编号
		$Sign_data['rem'] = '';// 商户编号
		//amt + "|" + cust_no+"|"+ mchnt_cd + "|" + mchnt_txn_ssn+"|"+ rem;
		
		/* 请求参数 */
		ksort($Sign_data);
		$Sign_old = '';
		foreach($Sign_data as $k => $v){
			if($k == 'ver'){
				$Sign_old .=$v;
				$Sign_old_a .=$k;
			}else{
				$Sign_old .= $v."|";
				$Sign_old_a .= $k."+|+";
			}
		}
		/* 签名数据 */
		$pSign=rsaSign($Sign_old,PRIVATE_KEY_PATH);

		$req = http_build_query($Sign_data)."&signature=".urlencode($pSign);
		/* 调用账户查询服务 */

		$options = array(
			CURLOPT_POST => TRUE,
			CURLOPT_RETURNTRANSFER => TRUE,
			CURLOPT_SSL_VERIFYPEER=>0,
			CURLOPT_SSL_VERIFYHOST=>0,
			CURLOPT_POSTFIELDS =>$req,
		
		); 
	    $ch = curl_init($post_url); 
	    curl_setopt_array($ch,$options); 
	   	$resultStr = curl_exec($ch);
	    curl_close($ch); 
		
		if (empty($resultStr)){
				//$err_count ++ ;
			}else{
				require_once APP_ROOT_PATH.'system/collocation/fuioupay/xml.php';
				$str3ParaInfo = @XML_unserialize($resultStr);
				$str3Req = $str3ParaInfo['ap']['plain'];
				$result = array();
				$result['resp_code'] = $str3Req["resp_code"];
				$result['mchnt_cd'] = $str3Req["mchnt_cd"];
				$result['mchnt_txn_ssn'] = $str3Req["mchnt_txn_ssn"];
				$result['amt'] = $str3Req["amt"];
				$result['suc_amt'] = $str3Req["suc_amt"];
				$result['signature'] =  $str3ParaInfo['ap']['signature'];
				
				if($str3Req["resp_code"] =='0000')
				{
					$result['status'] = 1;
					return 1;
				}else{
					$result['status'] = 0;
					return 0;
				}	
			}
	}
	
	
?>